<?php


namespace app\common\model;

use think\Model;

class Activity extends Model
{
    // 表名
    protected $name = 'activity';
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = '';
    // 追加属性
    protected $append = [
    ];

    /**
     * @var null|static 实例对象
     */
    protected static $instance = null;

    protected function getImageAttr($value)
    {
        return $value ? explode(',', $value) : null;
    }

    /**
     * 获取示例
     * @param array $options 实例配置
     * @return static
     */
    public static function instance($options = [])
    {
        if (is_null(self::$instance)) self::$instance = new self($options);

        return self::$instance;
    }

    public function userSignUp()
    {
        return $this->hasMany(SignUp::class, 'activity_id', 'id')
            ->field('user_id, activity_id');
    }
}